﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;

namespace IHISCETeim.Web.MachineSys.PublicModel
{
    public partial class BOMSeacher : PageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.查看 };
            }
        }


        protected override string DWZRef
        {
            get { return "BOMSeacher"; }
        }

        protected string IntrSerial {
            get
            {
                return GetRequestValue<string>("IntrSerial","");
            }
        }

        protected string sbodb {
            get
            {
                return GetRequestValue<string>("sbodb", "SBOConnectionString");
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (GetRequestValue<string>("ajaxmethod", "") == "getcardinfo")
            {
                getcardinfo();
                return;
            }
            else
            {
                DataBind();
            }
        }

        protected void DataBind()
        {
            if (!string.IsNullOrEmpty(IntrSerial)) { 
                this.rpMenu.DataSource = SBOController.GetBOMByIntrSerial(IntrSerial, sbodb);
                this.rpMenu.DataBind();
            }
        
        }
        private void getcardinfo()
        {
            string cardcode=GetRequestValue<string>("cardcode","");
            string r = SBOController.GetCardInfo(cardcode);

            Response.Write( string.Format("{{\"msg\":\"{0}\"}}",r));
            Response.End();
        }
    }
}